FROM ubuntu:20.04
# FROM nvidia/cuda:11.7.1-devel-ubuntu22.04

COPY Python-3.11.9.tgz /tmp/Python-3.11.9.tgz
COPY code/LLaMA-Factory-main /LLaMA-Factory-main


# 更新系统包
RUN apt-get update && apt-get install -y git build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev liblzma-dev libbz2-dev curl wget net-tools iputils-ping pdsh

RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt -y install libopenmpi-dev nvidia-cuda-toolkit

# 安装Python
WORKDIR /home/user

# RUN wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz && \
RUN cd /tmp/ && tar -zvxf Python-3.11.9.tgz && cd Python-3.11.9 && \
  ./configure --enable-optimizations && make -j 4 && make install

RUN rm -rf /tmp

RUN cd /LLaMA-Factory-main \
    && pip3 install mpi4py -i https://pypi.mirrors.ustc.edu.cn/simple \
    && pip3 install -e ".[torch,metrics]" -i https://pypi.mirrors.ustc.edu.cn/simple \
    && pip3 install deepspeed -i https://pypi.mirrors.ustc.edu.cn/simple
